﻿using System;
using System.IO;
using System.Reflection;
using CuteSprite.Eme.UI.Utils;
using HmFramework.Data;

namespace CuteSprite.Eme.Client.UI
{
	public partial class FrmTesting : EmeEntityForm
	{
		#region -- 构造 --

		#region - 新增 -

		/// <summary>默认构造函数</summary>
		public FrmTesting()
			: base()
		{
			InitializeComponent();
			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="templateFileName">模板文件</param>
		public FrmTesting(String templateFileName)
		{
			SetupFromXml(templateFileName);
			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="resourceName">模板资源文件</param>
		/// <param name="asm">模板资源文件所在程序集</param>
		public FrmTesting(String resourceName, Assembly asm)
		{
			SetupFromXmlResource(resourceName, asm);
			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="stream">模板数据流</param>
		public FrmTesting(Stream stream)
		{
			SetupFromXmlStream(stream);
			InitForm();
		}

		#endregion

		#region - 编辑或新增 -

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		public FrmTesting(IEntity entity)
			: this(entity, false)
		{
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="readOnly">是否只读，指定编辑还是浏览实体信息</param>
		public FrmTesting(IEntity entity, Boolean readOnly)
			: base(entity, readOnly)
		{
			InitializeComponent();
			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="templateFileName">模板文件</param>
		public FrmTesting(IEntity entity, String templateFileName)
			: this(entity, templateFileName, false)
		{
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="templateFileName">模板文件</param>
		/// <param name="readOnly">是否只读，指定编辑还是浏览实体信息</param>
		public FrmTesting(IEntity entity, String templateFileName, Boolean readOnly)
			: base(entity, readOnly)
		{
			SetupFromXml(templateFileName);

			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="resourceName">模板资源文件</param>
		/// <param name="asm">模板资源文件所在程序集</param>
		public FrmTesting(IEntity entity, String resourceName, Assembly asm)
			: this(entity, resourceName, asm, false)
		{
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="resourceName">模板资源文件</param>
		/// <param name="asm">模板资源文件所在程序集</param>
		/// <param name="readOnly">是否只读，指定编辑还是浏览实体信息</param>
		public FrmTesting(IEntity entity, String resourceName, Assembly asm, Boolean readOnly)
			: base(entity, readOnly)
		{
			SetupFromXmlResource(resourceName, asm);

			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="stream">模板数据流</param>
		public FrmTesting(IEntity entity, Stream stream)
			: this(entity, stream, false)
		{
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="stream">模板数据流</param>
		/// <param name="readOnly">是否只读，指定编辑还是浏览实体信息</param>
		public FrmTesting(IEntity entity, Stream stream, Boolean readOnly)
			: base(entity, readOnly)
		{
			SetupFromXmlStream(stream);

			InitForm();
		}

		#endregion

		#endregion
	}
}
